home *** CD-ROM | disk | FTP | other *** search
- program TstHuff;
-
- {$APPTYPE CONSOLE}
-
- uses
- SysUtils,
- Classes,
- AABufStm,
- AAHuffmn;
-
- var
- InStr : TFileStream;
- OutStr : TFileStream;
-
- InBufStm : TaaBufferedStream;
- OutBufStm : TaaBufferedStream;
- begin
- try
- writeln('Huffman compression test');
- writeln('Compressing...');
- InStr := TFileStream.Create('LLL.TXT', fmOpenRead);
- try
- OutStr := TFileStream.Create('LLL.HUF', fmCreate);
- try
- InBufStm := TaaBufferedStream.Create(InStr, 16*1024);
- try
- OutBufStm := TaaBufferedStream.Create(OutStr, 16*1024);
- try
- HuffmanCompress(InBufStm, OutBufStm);
- finally
- OutBufStm.Free;
- end;
- finally
- InBufStm.Free;
- end;
- finally
- OutStr.Free;
- end;
- finally
- InStr.Free;
- end;
- writeln('Done');
-
- writeln('Decompressing...');
- InStr := TFileStream.Create('LLL.HUF', fmOpenRead);
- try
- OutStr := TFileStream.Create('LLL.HTX', fmCreate);
- try
- InBufStm := TaaBufferedStream.Create(InStr, 16*1024);
- try
- OutBufStm := TaaBufferedStream.Create(OutStr, 16*1024);
- try
- HuffmanDecompress(InBufStm, OutBufStm);
- finally
- OutBufStm.Free;
- end;
- finally
- InBufStm.Free;
- end;
- finally
- OutStr.Free;
- end;
- finally
- InStr.Free;
- end;
- writeln('Done');
- except
- on E:Exception do
- writeln(E.Message);
- end;
- readln;
- end.
-
-